<%@ include file="/WEB-INF/views/taglib.jsp" %>
 <c:url value="/assetModel/serialNoSearch" var="paginationUrl"></c:url>
 <div>
 <h3 class="left">Asset Equipment Search</h3>
 <a onclick="$('.searchCriteria').toggle();" class="button right">
	 <img align="absmiddle" src="${imageUrl}/icon_detail.png"> Toggle Search Criteria
</a>
</div>
<div class="clear"></div>
 <form:form id="form" method="get" modelAttribute="searchCriteria" cssClass="simpleForm">
 <div class="searchCriteria">
 <fieldset>
 	<legend>Search Criteria</legend>
 	<div class="span-11">
	<p>
	<form:label path="search['assetModel.assetModelName']" >
	Asset Model Name  
	</form:label> 
	<form:input path="search['assetModel.assetModelName']"/>
	</p>
	<p>
	<form:label path="search['assetEquipmentPK.serialNo']">
	Serial No
	</form:label> 
	<form:input path="search['assetEquipmentPK.serialNo']"/>
	</p>
	<p>
	<form:label path="search['location.locationName']">
	Location
	</form:label>
	<form:select id="formLocation" path="search['location.locationName']">
		<form:option value=""></form:option>
	 	<form:options items="${globalLocation}" itemLabel="locationName" itemValue="locationName" />
	 </form:select> 
	
	</p>
	</div>
	<div class="span-11">
	<p>
	<form:label path="search['subLocationId']">
	Taxi No
	</form:label> 
	<form:input path="search['subLocationId']"/>
	</p>
	<p>
	<form:label path="search['assetEquipmentStatus']">
	Status
	</form:label>
	<form:select id="assetEquipmentStatus" path="search['assetEquipmentStatus']" class="assetEquipmentStatus">
			<form:option value=""></form:option>
			<form:option value="ACTIVE">ACTIVE</form:option>
			<form:option value="REPAIR">REPAIR</form:option>
			<form:option value="FAULT">FAULT</form:option>
			<form:option value="INACTIVE">INACTIVE</form:option>
	</form:select>
	</p>
	<p>
	<form:label path="search['companyCode']">
	Company Code
	</form:label> 
	<form:select id="companyCode" path="search['companyCode']" class="companyCode">
		<form:option value=""></form:option>
		<form:options items="${globalCompanyCode}" itemValue="systemCode1" itemLabel="systemCodeValueDescription" />
	</form:select>
	</p>
	</div>
</fieldset>
	<span class="right">
	  	<button type="submit" class="button">Search</button>
	 </span>
 </div>
 </form:form>	
 <div class="clear"></div>
 <fieldset>
 	<legend>Search Result</legend>
 	<c:choose>
 		<c:when test="${searchResult.resultCount==0}">
 		<div class="notice">
 		<span class="ui-icon ui-icon-info left marginright5"></span>
 		No records </div>
 		</c:when>
 	<c:otherwise>
 	<table class="gridSearch">
	 	<col width="5%">
		<col width="10%">
	 	<col width="12%">
	 	<col width="25%">
	 	<col width="10%">
	 	<col width="15%">
	 	<col width="8%">
	<thead>	
	<tr>
 		<th>S/N</th>
 		<th>
 		<aims:sort columnName="assetModel.assetModelName" label="Asset Model"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="assetEquipmentPK.serialNo" label="Serial No"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="location.locationName" label="Location"></aims:sort>
 		</th>
 		<th>
 		<aims:sort columnName="subLocationId" label="Taxi No"></aims:sort>
 		</th>
 		<th>
 		Information
 		</th>
 		<th>
 		<aims:sort columnName="assetEquipmentStatus" label="Status"></aims:sort>
 		</th>
 	</tr>
 	</thead>
 <tbody>
 	<c:forEach items="${searchResult.result}" var="result" varStatus="status">
 		<tr <c:if test="${(status.count%2)==0 }">class="alt"</c:if>>
	 	<td class="seqNo">${searchResult.recordNo+status.index}</td>
	 	<td>${result.assetModel.assetModelName}
	 	</td>
	 	<td>
	 	<c:url value="/assetModel/updateSerialNumber" var="editUrl"></c:url>
	 	<sec:authorize access="authenticated and (hasRole('ACCESS_SUPER_ADMIN') or hasRole('ACCESS_MASTER') or hasRole('ACCESS_MASTER_SERIAL_NO_UPDATE')) ">  
	 	<a href="${editUrl}/${result.assetEquipmentPK.serialNo}" title="Update Serial No" > </sec:authorize>
	 	${result.assetEquipmentPK.serialNo}
	 	<sec:authorize access="authenticated and (hasRole('ACCESS_SUPER_ADMIN') or hasRole('ACCESS_MASTER') or hasRole('ACCESS_MASTER_SERIAL_NO_UPDATE')) ">
	 	</a>
	 	</sec:authorize>
	 	
	 	
	 	
	 	
	 	</td>
	 	<td>${result.location.locationName }</td>
	 	<td>${result.subLocationId}</td>	
	 	<td>
	 	<small>
	 	P : $${result.unitPrice}<br>
	 	C : ${result.companyCode}<br>
	 	AT : ${result.assetTag}
	 	
	 	</small>
	 	</td>
	 	<td>${result.assetEquipmentStatus}</td>
 		</tr>
 	</c:forEach>
 </tbody>
 <tfoot>
 	<tr><td colspan="10" align="right">
 		<jsp:include page="/WEB-INF/views/pagination.jsp">
 			<jsp:param name="paginationUrl" value="${paginationUrl}" />
 		</jsp:include>
 	</td></tr>
 </tfoot>
 
 </table>
 </c:otherwise>
 </c:choose>
 </fieldset>
  
  
<script type="text/javascript">
		$(document).ready(function() {
			$('.searchCriteria').hide();
		});
</script>